feat(provenance): kb.graph_export gains format=json for a webapp graph view - #705
feat(provenance): kb.graph_export gains format=json for a webapp graph view#705Tet-9 wants to merge 1 commit into
Conversation
…h view
graph_export previously supported dot and mermaid text formats only.
Added json: {nodes: [{id, kind, label, status}], edges: [{src, dst,
kind}]}, same node/edge walk as the existing formats -- dot and mermaid
are byte-identical to before (verified: a dot export taken before and
after a json export match exactly, and a committed regression test
enforces this).
status is the artifact's own durable ClaimStatus/PageStatus for claim/page
nodes, null for source/evidence/session/event nodes (no status concept)
and for a dangling id. Scope note left in the code: pending proposals are
not graph nodes at all currently (build_graph reads only durable
artifacts), so full pending-vs-approved coloring per the issue's
description would need a bigger change to build_graph itself -- not
attempted here, flagged as a follow-up rather than silently narrowed.
- provenance/query.py: new _to_json(), fmt validation extended to accept
'json', graph_export docstring updated.
- cli.py: --format Choice extended to include json.
- New tests/test_provenance.py cases: json shape/status correctness, and
an explicit dot-output-unchanged-by-json regression test.
Not done in this pass (backend-only, out of scope for a fast turnaround):
the React MemoryNetworkView.tsx frontend component the issue also asks
for -- pan/zoom graph visualization, wired into Shell + ArtifactDrawer.
Closes vouchdev#604 (backend half)
|
the byte-identical regression test on but those scope notes are also why i would want a decision from a maintainer before this merges. #604 asks for a graph view where the pending frontier is visible; this ships the serializer with pending explicitly out of scope, and the React component explicitly out of scope. what lands is a third output format for one concrete implementation note. status = store.get_claim(n).status.value
...
status = store.get_page(n).status.value
the signature asymmetry is the tell — |
|
closing this — it ships a format with no consumer, and the part of #604 that carries the value is explicitly deferred. #604 asks for a graph view where the pending frontier is visible. this PR's own scope note says pending proposals are not graph nodes at all, because that is a reasonable slice to propose, but merging it means carrying a public output format on there is also a concrete regression in it. status = store.get_claim(n).status.value
...
status = store.get_page(n).status.value
the byte-identical what would get this merged: teach |
If you may reopen this, I'd then make all changes required on it ASAP |
what
kb.graph_export(the DAG behindvouch graph) supporteddotandmermaidtext formats only. Addedjson:{nodes: [{id, kind, label, status}], edges: [{src, dst, kind}]}, using the exact same node/edge walk as the existing formats.why
A webapp graph view (pan/zoom visualization of the KB's provenance DAG) needs structured data, not Graphviz text.
statusis populated from each node's own durableClaimStatus/PageStatuswhere the node kind carries one —nullfor source/evidence/session/event nodes, which have no status concept, and for a dangling id.Scope note, left directly in the code: pending proposals are not graph nodes at all today —
build_graphreads only durable (approved) artifacts, neverproposed/. Fully supporting "pending vs. approved" coloring the way the originating issue describes would mean teachingbuild_graphitself to walk pending proposals — a materially bigger change than a serializer addition. Flagged as a follow-up rather than silently narrowing whatstatusmeans.Also out of scope for this PR: the React
MemoryNetworkView.tsxfrontend component (pan/zoom rendering,Shell/ArtifactDrawerwiring) the originating issue also asks for. This PR is the backend half only.invariants held
dotandmermaidoutput are byte-identical to before — verified with an explicit regression test that takes adotexport, requests ajsonexport, then takes anotherdotexport and asserts they match exactly.id,kind,label,status) regardless of kind;statusisnull, never omitted, when a kind has no status concept.tests
test_graph_export_json: shape correctness, real status values for claim/page nodes,nullfor other kinds.test_graph_export_json_does_not_affect_dot_or_mermaid: the byte-identical regression check above.test_provenance.py+test_capabilities.py+test_trust.py: passing.Closes #604 (backend half — see scope notes above for what's intentionally not included)